﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Jumpton.SFA.Server.BusinessRule.MasterData;
using Jumpton.SFA.Server.Entity;
using Jumpton.SFA.Server.BusinessRule;
using Jumpton.SFA.Server.BusinessRule.InStoreDataMeasures;
using Jumpton.Persistent;
using Jumpton.SFA.Server.BusinessRule.CallRoute;

public partial class CallRoute_Visit_KPI_List : PageBase
{
    private decimal id = 0;
    private const string CHANNEL_ID = "id";
    private decimal visitid = 0;
    private const string VISIT_ID = "visitid";
    private string NAME = "";
    private string USERNAME = "";
    private string VISITTIME = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString[CHANNEL_ID] != null)
        {
            decimal.TryParse(Request.QueryString[CHANNEL_ID], out id);
        }
        if (Request.QueryString[VISIT_ID] != null)
        {
            decimal.TryParse(Request.QueryString[VISIT_ID], out visitid);
        }
        NAME = Request.QueryString["name"];
        USERNAME = Request.QueryString["username"];
        VISITTIME = Request.QueryString["visittime"];

        if (!IsPostBack)
        {
            GetVisitKPIByCustomerID();
            lblVisitHistoryMessage.Text = "[门店名称:  " + NAME + "]" + "      [巡店督导:  " + USERNAME + "]" + "      [拜访时间:  " + VISITTIME + "]";
        }
    }

    public void GetVisitKPIByCustomerID()
    {
        DataSet ds = RouteManager.SearchVisitKPIByVISITID(id,visitid);
        gvVisit.DataSource = ds;
        gvVisit.DataBind();
    }

    protected void btnResearch_Click(object sender, EventArgs e)
    {
        Response.Redirect("Visit_History_List.aspx");
    }
}
